#!/bin/bash

# LTGSQL构建脚本
set -e

echo "Building LTGSQL Database System..."

# 检查依赖
if ! command -v gcc &> /dev/null; then
    echo "Error: gcc is required but not installed"
    exit 1
fi

if ! command -v make &> /dev/null; then
    echo "Error: make is required but not installed"
    exit 1
fi

# 创建构建目录
mkdir -p build
mkdir -p bin

# 构建项目
make -j$(nproc)

echo "Build completed successfully!"
echo "Binary location: ./bin/ltgsql"
echo "Version: $(./bin/ltgsql --version 2>/dev/null || echo "0.1.0")"